package com.drools.rule;

import com.alibaba.fastjson.JSON;
import org.kie.api.runtime.KieSession;
import org.kie.internal.io.ResourceFactory;
import org.kie.internal.utils.KieHelper;

/**
 * drools 在规则中更新fact并将更新后的fact作为下一个规则的触发条件
 * */
public class RuleTest2 {

    public static void main(String[] args) {

       /* KieHelper helper = new KieHelper();
        String path = Thread.currentThread().getContextClassLoader().getResource("").getPath()+ "/rule2.drl";
        helper.addResource(ResourceFactory.newFileResource(path));
        KieSession kSession = helper.build().newKieSession();

        INPUTDATA actionReq = new INPUTDATA();
        actionReq.setCardType("1001");
        actionReq.setInspect_money(60000);
        actionReq.setRh_education("其他");
        actionReq.setRh_score(0);

        OUTPUTDATA actionResp = new OUTPUTDATA();
        System.out.println("req : "+ JSON.toJSONString(actionReq));
        kSession.insert(actionReq);
        kSession.insert(actionResp);


        kSession.fireAllRules();
        kSession.dispose();
        System.out.println("resp : "+ JSON.toJSONString(actionResp));*/
    }
}
